<%--
  Created by IntelliJ IDEA.
  User: wangjian
  Date: 14-4-16
  Time: 上午9:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<html>
<head>
    <%@include file="../../common/include_list_head.jsp" %>
    <title></title>
    <script type="text/javascript">
        var idRoles = window.parent.document.getElementById("rolesId").value;
        /****初始化，以勾选内容***/
        $(document).ready(function () {
            if ("" != idRoles) {
                var RoleId = idRoles.split(",");
                $("input[name='selectNodeMenu']").each(function () {
                    var textValue = $(this).val();
                    for (var i = 0; i < RoleId.length; i++) {
                        if (RoleId[i] == textValue) {
                            $("#Role_" + textValue).attr("checked", "checked");
                        }
                    }
                });
            }
        });
        function CheckedInfo(obj) {
            var role = $("#Role_" + obj).val();
            if ($("#Role_" + obj).attr("checked")) {
                idRoles = idRoles + "," + role;
            } else {
                if ("" != idRoles) {
                    var msg = "";
                    var roles = idRoles.split(",");
                    for (var j = 0; j < roles.length; j++) {
                        if (roles[j] != role) {
                            msg = "," + roles[j];
                        }
                    }
                    idRoles = msg;
                }
            }
            window.parent.document.getElementById("rolesId").value = idRoles;
        }


    </script>

</head>
<body>
<div style="width:100%">
<s:iterator value="resultData" status="status">
    <div style="margin-top: 20px">
    <li style="float: left;width: 20%">
    <input type="checkbox" id="Role_<s:property value="roleid"/>" name="selectNodeMenu"
           value="<s:property value="roleid"/>"
           onclick="CheckedInfo('<s:property value="roleid"/>');"/>
    <label><s:property value="rolename"/></label>
    </li>
    </div>
</s:iterator>
</div>
</body>
</html>
